package com.learn.design.observe.jdk;

import java.util.Observable;
import java.util.Observer;

/**
 * @author Administrator
 */
public class WeChatClient implements Observer {

    private String username;

    public WeChatClient(String username) {
        this.username = username;
    }

    @Override
    public void update(Observable o, Object arg) {
        WechatNotice notice = (WechatNotice) arg;
        System.out.printf("用户<%s> 接收到 <%s>微信公众号 的推送，文章标题为 <%s>%n", username, notice.getPublisher(), notice.getArticleName());
    }
}

